<?php
ob_start();
try{
$wgExtensionCredits['parserhook'][] = array(
        'path' => __FILE__,     // Magic so that svn revision number can be shown
        'name' => "Example Extension",
        'description' => "A simple example parser function extension",    // Should be using descriptionmsg instead so that i18n is supported (but this is a simple example).
        'version' => 1, 
        'author' => "Me",
        'url' => "http://localhost/mediawiki-1.17.0/index.php?title=Manual:Parser_functions",
);
 
# Define a setup function
$wgHooks['ParserFirstCallInit'][] = 'iframeParserFunction_Setup';
# Add a hook to initialise the magic word
$wgHooks['LanguageGetMagic'][]       = 'iframeParserFunction_Magic';
ob_end_clean();
}catch(Exception $e){}
 
function iframeParserFunction_Setup( &$parser ) {
        # Set a function hook associating the "applet" magic word with our function
 $parser->setFunctionHook( 'iframe', 'iframeParserFunction_Render' );
        return true;
}
 
function iframeParserFunction_Magic( &$magicWords, $langCode ) {
        # Add the magic word
        # The first array element is whether to be case sensitive, in this case (0) it is not case sensitive, 1 would be sensitive
        # All remaining elements are synonyms for our parser function
        $magicWords['iframe'] = array( 0,'iframe' );
        # unless we return true, other parser functions extensions won't get loaded.
        return true;
}
 
function iframeParserFunction_Render( $parser, $width=850, $height = 800, $src="/mediawiki-1.17.0/extensions/Iframe/ime-editor/ime-editor.php", $style="border:none; overflow:hidden" ) {
        # The parser function itself
        # The input parameters are wikitext with templates expanded
        # The output should be wikitext too
       // $output = "param1 is $width and param2 is $height";
	$width = ($width>0?$width:850);
	$height = ($height>0?$height:800);
	 $output="<iframe src='".$src."'"." width='".$width."' height='".$height."' style='".$style."' frameborder='0' scrolling='no'>
  <p>Your browser does not support iframes.</p>
</iframe>";

        return array( $output, 'noparse' => true, 'isHTML' => true );
}
